var core = require('core');

var unsubscribe = function(data, callback){

    core.api('user/unsubscribe', data, function(err, doc){

        try {
            if(doc.code)
                throw new Error(doc.msg)
            if(callback && typeof callback === 'function') callback(doc);
        } catch (e) {
            console.error(doc.message);
            if(callback && typeof callback === 'function') callback(e);
        }

    });
};

module.exports = unsubscribe;
